package com.ruoyi.web.controller.order;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.order.domain.MesSendFactoryLog;
import com.ruoyi.order.service.IMesSendFactoryLogService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 检测结果发送工厂日志Controller
 * 
 * @author guoxl
 * @date 2025-07-03
 */
@RestController
@RequestMapping("/order/sendLog")
public class MesSendFactoryLogController extends BaseController
{
    @Autowired
    private IMesSendFactoryLogService mesSendFactoryLogService;

    /**
     * 查询检测结果发送工厂日志列表
     */
    @PreAuthorize("@ss.hasPermi('order:sendLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(MesSendFactoryLog mesSendFactoryLog)
    {
        startPage();
        List<MesSendFactoryLog> list = mesSendFactoryLogService.selectMesSendFactoryLogList(mesSendFactoryLog);
        return getDataTable(list);
    }

    /**
     * 导出检测结果发送工厂日志列表
     */
    @PreAuthorize("@ss.hasPermi('order:sendLog:export')")
    @Log(title = "检测结果发送工厂日志", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, MesSendFactoryLog mesSendFactoryLog)
    {
        List<MesSendFactoryLog> list = mesSendFactoryLogService.selectMesSendFactoryLogList(mesSendFactoryLog);
        ExcelUtil<MesSendFactoryLog> util = new ExcelUtil<MesSendFactoryLog>(MesSendFactoryLog.class);
        util.exportExcel(response, list, "检测结果发送工厂日志数据");
    }

    /**
     * 获取检测结果发送工厂日志详细信息
     */
    @PreAuthorize("@ss.hasPermi('order:sendLog:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(mesSendFactoryLogService.selectMesSendFactoryLogById(id));
    }

    /**
     * 新增检测结果发送工厂日志
     */
    @PreAuthorize("@ss.hasPermi('order:sendLog:add')")
    @Log(title = "检测结果发送工厂日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MesSendFactoryLog mesSendFactoryLog)
    {
        return toAjax(mesSendFactoryLogService.insertMesSendFactoryLog(mesSendFactoryLog));
    }

    /**
     * 修改检测结果发送工厂日志
     */
    @PreAuthorize("@ss.hasPermi('order:sendLog:edit')")
    @Log(title = "检测结果发送工厂日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MesSendFactoryLog mesSendFactoryLog)
    {
        return toAjax(mesSendFactoryLogService.updateMesSendFactoryLog(mesSendFactoryLog));
    }

    /**
     * 删除检测结果发送工厂日志
     */
    @PreAuthorize("@ss.hasPermi('order:sendLog:remove')")
    @Log(title = "检测结果发送工厂日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(mesSendFactoryLogService.deleteMesSendFactoryLogByIds(ids));
    }
}
